#pragma once
#include "MovableObject.h"
#include <Ogre.h>
#include <stack>

struct Action
{
	enum ACTION_TYPE{ACTION_IDLE = 0, ACTION_NAVIGATE = 1};

	Action(void) : mType(Action::ACTION_IDLE), mTimeout(0), mpTarget(NULL), mRepeat(false){}
	Action(ACTION_TYPE type, float time, PathNode* pTarget, bool repeat) : mType(type), mTimeout(time), mpTarget(pTarget), mRepeat(repeat){}
	ACTION_TYPE mType;
	float mTimeout;
	PathNode* mpTarget;
	bool mRepeat;
};

class Agent : public MovableObject
{
public:
	Agent(void);
	Agent(Ogre::SceneManager* pSceneMgr);
	~Agent(void);
	void update(const Ogre::FrameEvent& evt);
	void pushAction(Action::ACTION_TYPE type, float timeout, PathNode* pNode, bool repeat);

private:
	void nextAction(void);
	bool nextWaypoint(void);
	void onActionChanged(void);
	void setAnimation(const std::string& animName);

	std::queue<Action*> mActions;
	Action* mpCurrentAction;

	std::stack<PathNode*> mPath;

	Ogre::AnimationState* mpAnimationState;
};
